package com.youlai.boot.modules.game.converter;

import com.youlai.boot.modules.game.model.entity.GameInform;
import com.youlai.boot.modules.game.model.entity.GameInformLink;
import com.youlai.boot.modules.game.model.form.GameInformForm;
import com.youlai.boot.modules.game.model.vo.GameInformVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 游戏通知对象转换器
 *
 * @author 有来技术团队
 */
@Mapper
public interface GameInformConverter {

    GameInformConverter INSTANCE = Mappers.getMapper(GameInformConverter.class);

    /**
     * 实体转VO
     */
    @Mapping(source = "createTime", target = "time")
    @Mapping(target = "read", ignore = true)
    GameInformVO entity2vo(GameInform entity);

    /**
     * 表单转实体
     */
    @Mapping(target = "createTime", ignore = true)
    @Mapping(target = "updateTime", ignore = true)
    GameInform form2entity(GameInformForm form);

    /**
     * 表单链接转实体链接
     */
    @Mapping(target = "informId", ignore = true)
    @Mapping(target = "createTime", ignore = true)
    @Mapping(target = "updateTime", ignore = true)
    GameInformLink linkForm2entity(GameInformForm.GameInformLinkForm linkForm);

    /**
     * 实体链接转VO链接
     */
    GameInformVO.GameInformLinkVO linkEntity2vo(GameInformLink linkEntity);

    /**
     * 实体链接列表转VO链接列表
     */
    List<GameInformVO.GameInformLinkVO> linkEntityList2voList(List<GameInformLink> linkEntityList);

    /**
     * 表单链接列表转实体链接列表
     */
    List<GameInformLink> linkFormList2entityList(List<GameInformForm.GameInformLinkForm> linkFormList);
} 